package org.smoozik.services.musictheory;

public class Degree {

	private Interval[] chordIntervals;
	private Interval[] scaleIntervals;
	private Interval indexFondamental;

	public Degree(Interval fondamentale, Interval[] chordIntervals,
			Interval[] scaleIntervals) {
		indexFondamental = fondamentale;
		setChordIntervals(chordIntervals);
		setScaleIntervals(scaleIntervals);
	}

	public Degree(Interval fondamentale) {
		indexFondamental = fondamentale;
	}

	public Scale getScaleForRoot(Note root) {
		Note note = getNoteForRoot(root);
		Scale scale = new Scale(note);
		scale.addIntervals(scaleIntervals);

		return scale;
	}

	public Chord getChordForRoot(Note root) {
		Note note = getNoteForRoot(root);
		Chord chord = new Chord(note);
		chord.setIntervals(chordIntervals);

		return chord;
	}

	public Note getNoteForRoot(Note root) {
		Note note = root.computeIntervalle(indexFondamental);

		return note;
	}

	public Interval[] getChordIntervals() {
		return chordIntervals;
	}

	public void setChordIntervals(Interval[] chordIntervals) {
		this.chordIntervals = chordIntervals;
	}

	public Interval[] getScaleIntervals() {
		return scaleIntervals;
	}

	public void setScaleIntervals(Interval[] scaleIntervals) {
		this.scaleIntervals = scaleIntervals;
	}

	public Interval getIndexFondamental() {
		return indexFondamental;
	}

	public void setIndexFondamental(Interval indexFondamental) {
		this.indexFondamental = indexFondamental;
	}
}
